package com.bwie.es;

import com.baomidou.mybatisplus.annotation.TableField;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

@Data
@Document(indexName = "es_user",shards = 1,replicas = 0)
public class EsUser implements Serializable {

    /**
     * 用户ID
     */
    @Field(type = FieldType.Keyword)
    @Id
    private Integer userId;

    /**
     * 登录账号
     */

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String userName;

    /**
     * 登录密码(只存储不索引)
     */
    @Field(index = false)
    private String userPass;

    /**
     * 真实项目
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String nickName;

    /**
     * 手机号
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String userMobile;

    /**
     * 邮箱
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String userEmail;

    /**
     * 头像
     */
    @Field(index = false)
    private String userAvatar;

    /**
     * 注册时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH-mm-ss")
    private Date createTime;


    @Field(type = FieldType.Integer)
    private Integer userStatus;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String reasion;


    private static final long serialVersionUID = 1L;
}
